home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13094 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  57 lines

  1. Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
  2. From: grantp@usa.pipeline.com(Pete Grant)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: URGENT..Help Needed!!
  5. Date: 23 Mar 1996 13:47:18 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4j0vd6$kn8@news1.h1.usa.pipeline.com>
  8. References: <4j0h0u$9dj$1@sydney.DIALix.oz.au>
  9. NNTP-Posting-Host: 38.8.60.7
  10. X-PipeUser: grantp
  11. X-PipeHub: usa.pipeline.com
  12. X-PipeGCOS: (Pete Grant)
  13. X-Newsreader: Pipeline v3.5.0
  14.  
  15. On Mar 23, 1996 20:41:50 in article <URGENT..Help Needed!!>,
  16. 'gonza@sydney.DIALix.oz.au (A and K Gonzalez)' wrote: 
  17.  
  18.  
  19. >Hello 
  20. >My name is Katyha Gonzalez and I need help with my programming. 
  21. >My main questions are how do initialise an array to zero or set them with 
  22.  
  23. >spaces? 
  24. Depends on the array.  Here are two examples: 
  25.  
  26. const int somesize = 1000; 
  27. int iarray[somesize]; 
  28. memset(iarray, 0, sizeof(iarray)); 
  29.  
  30. char * carray = new char[somesize]; 
  31. memset(carray, ' ', somesize); 
  32. >How can I search through my arrays looking for a space in them? Do I use  
  33. >a while loop?? 
  34.  
  35. #include <string.h> 
  36. char * pc = strchr(carray, ' '); 
  37. >And lastly, how do I list all items in the array, one per line?? 
  38. // switching from C to C++ (this is comp.lang.c++) 
  39. for (int i = 0; i < somesize; i++) 
  40.   cout << carray[i] << endl; 
  41.  
  42. >These answers or help/hints would be greatly appreciated, so please send  
  43. >me some help on  
  44. If you get an "A" (or do they grade numerically in Australia?), 
  45. I want half of it :-) 
  46.  
  47. -- 
  48. Pete Grant 
  49. Kalevi, Inc. 
  50. Software Engineering & development
  51.